package typeinfo;//: typeinfo/SweetShop.java
// Examination of the way the class loader works.

import static net.mindview.util.Print.*;

class Candy {
  static {
    print("Loading Candy");
  }
}

class Gum {
  static {
    print("Loading Gum");
  }
}

class Cookie {
  static {
    print("Loading Cookie");
  }
}

public class SweetShop {
  public static void main(String[] args) {
    print("inside main");
    new Candy();
    print("After creating Candy");
    try {
      Class.forName("typeinfo.Gum");
    } catch (ClassNotFoundException e) {
      print("Couldn't find Gum");
    }
//    Class clazz =typeinfo.Gum.class;
//    System.out.println(clazz.toString());
    print("After Class.forName(\"Gum\")");
    new Cookie();
    print("After creating Cookie");
  }
} /* Output:
inside main
Loading Candy
After creating Candy
Loading Gum
After Class.forName("Gum")
Loading Cookie
After creating Cookie
*///:~
